<template>
  <div class="announcement-container">
    <!-- 顶部标题 -->
    <Header />
    <div class="back-page">
      <!-- 公告页面内容 -->
      <div class="announcement-page">
        <!-- 返回与导航 -->
        <div class="navigation">
          <el-link type="primary" :href="href" class="back-link" icon="DArrowLeft">返回</el-link>
          <span> 首页 / 帮助中心</span>
        </div>
        <div style="width: 80%; margin: auto">
          <!-- 公告标题 -->
          <div class="notice-title">{{ notice.noticeTitle }}</div>

          <!-- 公告元信息 -->
          <div class="notice-meta">
            <span>作者：{{ notice.createBy }}</span>
            <span>发布日期：{{ notice.createTime }}</span>
          </div>

          <!-- 公告内容 -->
          <div class="notice-content" v-html="notice.noticeContent"></div>

          <!-- 配图区域 -->
          <!-- <div class="image-placeholder">配图</div> -->

          <!-- 第二段内容及配图 -->
          <!-- <div class="notice-additional-content">
        <p>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</p>
        <p>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</p>
        <p>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</p>
        <div class="image-placeholder">配图</div>
      </div> -->
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref, computed } from "vue";
import { useRouter, useRoute } from "vue-router";
import { noticeInfo } from "@/api/helpNotice";
import Header from "../../components/Header.vue";

const route = useRoute();
const href = ref("/help");
const noticeId = computed(() => route.query.noticeId);
const notice = ref({});

// 获取公告详情
const getNoticeInfo = () => {
  noticeInfo({ noticeId: noticeId.value }).then((res) => {
    if (res.code === 200) {
      notice.value = res.data;
    }
  });
};

onMounted(() => {
  if (route.query.type === "index") {
    href.value = "/";
  }
  if (route.query.type === "indexView") {
    href.value = "/index";
  }
  getNoticeInfo();
});
</script>

<style scoped>
.announcement-page {
  max-width: 1300px;
  width: 80%;
  margin: auto;
  padding-top: 10px;
}
.announcement-container {
  font-family: Arial, sans-serif;
  color: #333;
  width: 100%;
}
.back-page {
  min-height: calc(100vh - 56px);
  background: url("../../assets/f87147698f07020d4fea348f49da0166.png") no-repeat center center;
  background-size: cover;
}
.header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 16px;
  text-align: left;
  font-size: 18px;
  font-weight: bold;
}

.navigation {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
  color: #666;
}

.back-link {
  margin-right: 8px;
}

.notice-title {
  font-size: 24px;
  font-weight: bold;
  margin: 16px 0;
  text-align: center;
}

.notice-meta {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #999;
  margin-bottom: 16px;
}

.notice-content {
  margin-bottom: 24px;
  line-height: 1.6;
}

.image-placeholder {
  width: 100%;
  height: 200px;
  background: #f0f0f0;
  border: 1px dashed #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px 0;
  color: #999;
  font-size: 14px;
}

.notice-additional-content {
  margin-top: 24px;
  line-height: 1.6;
}
</style>
